const axios=require('axios');

axios.defaults.baseURL='http://localhost:3000/api/v1';
axios.defaults.headers.common['Authorization'] = 'AUTH_TOKEN';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';

(async ()=>{
    let getUser = axios.create({
        method:'GET',
        baseURL: 'http://localhost:3000/api/v2',
        url:'user'
    });

    let data=await getUser({
        params:{id:100}
    });
    console.log('Get data:',data.data);

    let regUser=axios.create({
        method:'POST',
        baseURL: 'http://localhost:3000/api/v3',
        url:'reg'
    });
    data=await regUser({
        params:{id:100},
        data:{
            name:'Tom',
            password:'123456'
        }
    });
    console.log('Post data:',data.data);

})();